{include file='header.tpl'}
{include file='admin/leftcol.tpl'}
<div id="left-area">
<div class="entry post clearfix width-for-all-img">
              <div class="breadcrumb">
            <span class="raquo"></span><a href="/">Главная</a>
           <span class="raquo"> &raquo; </span><a href="{geturl controller="admin" action="index"}">Админ панель</a>  
           <span class="raquo"> &raquo; </span><a href="{geturl controller='admin' action='users'}">Пользователи</a>  
    </div>
    <h1 class="category-title">Пользователи</h1> 
      <div class="product-filter">
       
       <div class="sort"> Магазин:  <select onchange="location = this.value;">
                <option value="{geturl action="users"}{if $type}?type={$type}{/if}" >Все пользователи</option>
                <option value="?shop=yes{if $type}&type={$type}{/if}" {if $shop=='yes'}selected{/if}>Продавцы</option>
                <option value="?shop=no{if $type}&type={$type}{/if}" {if $shop=='no'}selected{/if}>Обычные пользователи</option>
            
            
            </select>
        </div>
         <div class="type">Статус:      <select onchange="location = this.value;">
                <option value="{geturl action="users"}{if $shop}?shop={$shop}{/if}" >Все пользователи</option>
                <option value="?type=1{if $shop}&shop={$shop}{/if}" {if $type=='1'}selected{/if}>Активные</option>
                <option value="?type=0{if $shop}&shop={$shop}{/if}" {if $type=='0'}selected{/if}>Не активные</option>
            
            
            </select>
        </div>
        
    
    </div>
        <div class="botline"></div>
    <table class="tdzayavki" style="width: 100%;">
          <thead>
            <tr> 
              <td class="tb1">
              {if $sort=='login'}
            <a href="?sort=login&order={if $order=='desc'}asc{else}desc{/if}" class="{$order}">Логин</a>
            {else}
            <a href="?sort=login&order={if $order=='desc'}asc{else}desc{/if}">Логин</a>
            {/if}
              </td>
              <td class="tb2">
               {if $sort=='first_name'}
            <a href="?sort=first&order={if $order=='desc'}asc{else}desc{/if}" class="{$order}">Имя</a>
            {else}
            <a href="?sort=first&order={if $order=='desc'}asc{else}desc{/if}">Имя</a>
            {/if}
              </td>
              <td class="tb3">
               {*if $sort=='last_name'}
            <a href="?sort=last_name&order={if $order=='desc'}asc{else}desc{/if}" class="{$order}">Фамилия</a>
            {else}
            <a href="?sort=last_name&order={if $order=='desc'}asc{else}desc{/if}">Фамилия</a>
            {/if*}
              </td>
             <td class="tb3">
               {if $sort=='nameshop'}
            <a href="?sort=nameshop&order={if $order=='desc'}asc{else}desc{/if}" class="{$order}">Название магазина</a>
            {else}
            <a href="?sort=nameshop&order={if $order=='desc'}asc{else}desc{/if}">Название магазина</a>
            {/if}
              </td>
              <td class="tb4">
                 {if $sort=='isApproved'}
            <a href="?sort=c.isApproved&order={if $order=='desc'}asc{else}desc{/if}" class="{$order}">Статус</a>
            {else}
            <a href="?sort=c.isApproved&order={if $order=='desc'}asc{else}desc{/if}">Статус</a>
            {/if}
              </td>
              <td class="tb5">Действие</td>
            </tr>
          </thead>

    {foreach from=$users item='user'}
   {if $user->type != 'globaladmin' || $identity->type == 'globaladmin'}
   <tr id="tr_{$user->getId()}">
        <td class="nocontainer fs12" id="name_{$user->getId()}">{$user->login}</td>
        <td>{$user->first_name}</td>
        <td class="nocontainer">{$user->last_name}</td>
        <td class="nocontainer">{$user->nameshop}</td>
       <td >
            {if $user->isApproved != 1}
            <img src="/images/index-07.png" id="img_{$user->getId()}" alt="" class="noborders">
           
            {else}
            <img src="/images/index-08.png" id="img_{$user->getId()}" alt="" class="noborders">
            {/if}
        </td>
           <td>
               <a href="{geturl route='admineditusers' id=$user->getId()}"><img src="/images/index-14.png" alt="Редактировать"></a>
                <a onclick="deleteuser({$user->getId()});" style="cursor: pointer"><img src="/images/index-07.png" alt="Удалить"></a>
                 <a  id="app_{$user->getId()}" onclick="approveuser({$user->getId()},{$user->isApproved})">
                     {if !$user->isApproved} <img src="/images/approve.png" alt="Одобрить" title="Одобрить" />{else} <img src="/images/block.png" alt="Заблокировать" title="Заблокировать" />{/if}</a>
           </td>
      
    </tr>
{/if}
    {/foreach}  
        </table>
        <br><br>

<div class="botline"></div>
{if $pages->count_pages > 1}
<div class="wp-pagenavi">
<span class="pages">Страница {$p} из {$pages->count_pages}</span> 
<!-- Previous page link -->
 <a href="{geturl controller="admin" action="users"}{if $type}?type={$type}{if $shop}&shop={$shop}{/if}{else}{if $shop}?shop={$shop}{/if}{/if}" class="last">«Первая</a> 
{if $pages->active > '1' }
<a href="{geturl controller="admin" action="users"}?p={$pages->active-1}{if $shop}&shop={$shop}{/if}{if $type}&type={$type}{/if}" >«</a> 
{/if}
<!-- Numbered page links -->
{section name=foo start=$pages->start loop=$pages->end step=1}

{if $smarty.section.foo.index != $pages->active }
<a href="{geturl controller="admin" action="users"}?p={$smarty.section.foo.index}{if $shop}&shop={$shop}{/if}{if $type}&type={$type}{/if}" class="page smaller">{$smarty.section.foo.index}</a> 
{else}
 <span class="current">{$smarty.section.foo.index}</span>
{/if}
{/section}
<!-- Next page link -->
{if $pages->active < $pages->count_pages}
<a href="{geturl controller="admin" action="users"}?p={$pages->active+1}{if $shop}&shop={$shop}{/if}{if $type}&type={$type}{/if}" class="nextpostslink">»</a>
 {/if}
 <a href="{geturl controller="admin" action="users"}?p={$pages->count_pages}{if $shop}&shop={$shop}{/if}{if $type}&type={$type}{/if}" class="last">Последняя»</a> 
 </div>
 {/if}
<div class="botline"></div>

        </div> 

</div>
{include file="footer.tpl"}